#ifndef DART_H_
#define DART_H_

#include <vector>
#include "vectorD.h"
#include "dataType.h"

class Dart
{
public:
	class Interval
	{
	public:
		Interval(DATA_TYPE begin, DATA_TYPE end) : begin_(begin), end_(end) {}
		DATA_TYPE getLength() const { return end_ - begin_; }

		DATA_TYPE begin_;
		DATA_TYPE end_;
	};

	Dart() {}
	virtual ~Dart() {}

	virtual void reset(unsigned int d) {}
	virtual void reset(unsigned int d, const VectorD& front, DATA_TYPE radius) {}

	virtual void updateIntervals(const std::vector<VectorD>& points, DATA_TYPE radius) = 0;
	virtual bool pickPoint(VectorD& point) = 0;

	static bool intervalBeginCompare(const Interval& lhs, const Interval& rhs);
	static bool intervalEndCompare(const Interval& lhs, const Interval& rhs);

protected:
};

inline bool Dart::intervalBeginCompare(const Interval& lhs, const Interval& rhs)
{
	return lhs.begin_ < rhs.begin_;
}

inline bool Dart::intervalEndCompare(const Interval& lhs, const Interval& rhs)
{
	return lhs.end_ < rhs.end_;
}
#endif